home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
phagexsources.lha
/
source
/
InterCircles.s
< prev
next >
Wrap
Text File
|
1994-07-09
|
6KB
|
443 lines
; Interference Circles, Just both playfields offsetted using plane Pointers
; and hardware offset, the clever bit is only HALF of a circle is used, the
; Bottom half is the top half reversed using a Negative Modulo
Opt c-
Section "Base Code",Code_c
Start Movem.l d0-d7/a0-a6,-(sp)
Bsr KillSys
Lea CopperList(pc),a0
Lea HardWare,a6
Move.l a0,Cop1Lc(a6)
Move.w #$83c0,DMACon(a6)
Loop Bsr VBL
Bsr DoXYSine
Bsr SetCircle
Btst #6,$Bfe001
Bne Loop
Bsr ReturnSys
Movem.l (sp)+,d0-d7/a0-a6
Moveq #0,d0
Rts
SetCircle Lea CopperBPLS(pc),a0
Lea CopperPos(pc),a1
Lea CircleGFX(pc),a2
Lea CircleXYPos(pc),a3
Lea CopperModA(pc),a5
Move.w #0,2(a1)
Bsr DoCircle
Or.w d1,2(a1)
Lea CopperModB(pc),a5
Lea CopperBPLS1(pc),a0
Lea CopperPos(pc),a1
Lea CircleGFX(pc),a2
Lea CircleXYPosa(pc),a3
Bsr DoCircle
Asl.w #4,d1
Or.w d1,2(a1)
Bsr SetPriority
Rts
DoCircle Moveq #0,d0
Moveq #0,d2
Moveq #0,d3
Moveq #0,d4
Move.w 2(a3),d4
Move.w #271-16,d0
Sub.w d4,d0
Bsr SetWait
Move.w 2(a3),d0
Add.w #32,d0
Move.l #64,d1
Muls d0,d1
Add.l d1,a2
Move.w 0(a3),d0
Add.w #5,d0
Asr.w #3,d0
Bclr #0,d0
Add.l d0,a2
Move.w 0(a3),d0
Add.w #5,d0
And.w #15,d0
Move.w #15,d1
Sub.w d0,d1
Move.w d1,d0
And.w #15,d0
Move.w d0,d1
Move.l a2,d0
Move.w d0,6(a0)
Swap d0
Move.w d0,2(a0)
Rts
SetWait Cmpi.w #$100,d0
Bls NoPalCopper
Move.l #$ffe1fffe,(a5)
Sub.w #$100,d0
Move.b d0,4(a5)
Rts
NoPalCopper Move.l #$01fc0000,(a5)
Move.b d0,4(a5)
Rts
SetPriority Lea CopperModA(pc),a0
Move.w CircleXYPos+2(pc),d0
Move.w CircleXYPosa+2(pc),d1
Cmp.w d0,d1
Ble NoChange
Move.l 00(a0),d0
Move.l 04(a0),d1
Move.l 12(a0),00(a0)
Move.l 16(a0),04(a0)
Move.l d0,12(a0)
Move.l d1,16(a0)
Move.l #$010aff92,08(a0)
Move.l #$0108ff92,20(a0)
Rts
NoChange Move.l #$0108ff92,08(a0)
Move.l #$010aff92,20(a0)
Rts
DoXYSine Lea CircleXYPos(pc),a4
Lea SineXPt(pc),a5
Bsr DoSine
Move.w d3,(a4)
Lea CircleXYPos+2(pc),a4
Lea SineYPt(pc),a5
Bsr DoSine
Move.w d3,(a4)
Lea CircleXYPos(pc),a4
And.w #511,0(a4)
And.w #511,2(a4)
Lea CircleXYPosa(pc),a4
Lea SineXPta(pc),a5
Bsr DoSine
Move.w d3,(a4)
Lea CircleXYPosa+2(pc),a4
Lea SineYPta(pc),a5
Bsr DoSine
Move.w d3,(a4)
Lea CircleXYPosa(pc),a4
And.w #511,0(a4)
And.w #511,2(a4)
Rts
DoSine Lea SineData(pc),a6
Moveq #0,d2
Moveq #0,d3
Move.l 08(a5),d0
Move.l 12(a5),d1
Add.l d0,00(a5)
Add.l d1,04(a5)
And.l #$ffe,00(a5)
And.l #$ffe,04(a5)
Move.l 00(a5),d0
Move.l 04(a5),d1
Move.w (a6,d0.l),d2
Move.w (a6,d1.l),d3
Add.l d2,d3
Asr.w #3,d3
Add.w #2416,d3
Muls #1000,d3
Divs #1500,d3
Rts
KillSys Bsr.s SysWait
Move.l $4,a6
Lea GFXName(pc),a1
Moveq #0,d0
Jsr -552(a6)
Lea OldCop1(pc),a5
Move.l $26(a0),$0(a5)
Move.l $32(a0),$4(a5)
Lea HardWare,a6
Move.w IntEnaR(a6),d0
Move.w DMAConR(a6),d1
Or.w #$8000,d0
And.w #$03ff,d1
Or.w #$8000,d1
Move.w d0,$8(a5)
Move.w d1,$a(a5)
Move.w #$7fff,IntEna(a6)
Move.w #$7fff,DMACon(a6)
Rts
SysWait Move.w #15,d7
SysWaitLoop Move.l #$05000,d1
Bsr.s WaitVBL
Bsr.s VBL
Dbf d7,SysWaitLoop
Rts
VBL Move.l #$13000,d1
WaitVBL Movem.l d0-d1/a6,-(sp)
Lea HardWare,a6
WaitVBLLoop Move.l VPosR(a6),d0
And.l #$1ff00,d0
Cmp.l d1,d0
Bne.s WaitVBLLoop
Movem.l (sp)+,d0-d1/a6
Rts
ReturnSys Lea HardWare,a6
Move.w OldIntEna(pc),IntEna(a6)
Move.w OldDMACon(pc),DMACon(a6)
Move.l OldCop1(pc),Cop1lc(a6)
Move.l OldCop2(pc),Cop2lc(a6)
Rts
GFXName Dc.b "graphics.library",0
Even
OldCop1 Dc.l 0
OldCop2 Dc.l 0
OldIntEna Dc.w 0
OldDmaCon Dc.w 0
CircleXYPos Dc.w 0
Dc.w 0
CircleXYPosa Dc.w 0
Dc.w 0
SineXPt Dc.l $1fe
SineXPt1 Dc.l 0
SineXAdd Dc.l -$20
SineXAdd1 Dc.l -$22
SineYPt Dc.l 0
SineYPt1 Dc.l 0
SineYAdd Dc.l $20
SineYAdd1 Dc.l $20
SineXPta Dc.l 0
SineXPt1a Dc.l 0
SineXAdda Dc.l -$20
SineXAdd1a Dc.l -$20
SineYPta Dc.l $1fe
SineYPt1a Dc.l 0
SineYAdda Dc.l $24
SineYAdd1a Dc.l $20
Cmv Macro
Dc.w \2,\1
EndM
Cwt Macro
Dc.w (\1*$100)+$01,$fffe
EndM
CwtBlit Macro
Dc.w $1,0
EndM
Pal Macro
Dc.w $ffe1,$fffe
EndM
EndCop Macro
Dc.w $ffff,$fffe
EndM
CopperList Cwt $15
Cmv $0200,BplCon0
CopperPos Cmv $00bb,BplCon1
Cmv $000a,BplCon2
Cmv $1661,DiwStrt
Cmv $36f1,DiwStop
Cmv $0028,DdfStrt
Cmv $00d8,DdfStop
Cmv $0012,BplMod1
Cmv $0012,BplMod2
Cwt $1f
Cmv $0000,Color00
Cmv $0000,Color01
Cmv $0000,Color02
Cmv $0fff,Color03
CopperBPLS Cmv $c,BplPt0h
Cmv $0,BplPt0l
CopperBPLS1 Cmv $0,BplPt1h
Cmv $0,BplPt1l
Cwt $20
Cmv $2200,BplCon0
CopperModA Cmv $0,$1fe
Cwt $28
Cmv $ff92,BplMod1
CopperModB Cmv $0,$1fe
Cwt $28
Cmv $ff92,BplMod2
EndCop
SineData Incbin Df0:SysData/Sine1024Bs.Dat
Incbin Df0:SysData/Sine1024Bs.Dat
CircleGFX Incbin Df0:Bitmaps/Circle1.Raw
****Custom Chip Registers****
Hardware = $Dff000
;Control Registers
Dmaconr = $002
Vposr = $004
Vhposr = $006
Joy0dat = $00A
Joy1dat = $00C
Clxdat = $00E
Intenar = $01C
Intereqr = $01E
Copcon = $02E
;Blitter Registers
Bltcon0 = $040
Bltcon1 = $042
Bltafwm = $044
Bltalwm = $046
Bltcpth = $048
Bltcptl = $04A
Bltbpth = $04C
Bltbptl = $04E
Bltapth = $050
Bltaptl = $052
Bltdpth = $054
Bltdptl = $056
Bltsize = $058
Bltcmod = $060
Bltbmod = $062
Bltamod = $064
Bltdmod = $066
Bltcdat = $070
Bltbdat = $072
Bltadat = $074
;Copper Registers
Cop1lc = $080
Cop1lch = $080
Cop1lcl = $082
Cop2lc = $084
Cop2lch = $084
Cop2lcl = $086
Copjmp1 = $088
Copjmp2 = $08A
Diwstrt = $08E
Diwstop = $090
Ddfstrt = $092
Ddfstop = $094
Dmacon = $096
Clxcon = $098
Intena = $09A
Intreq = $09C
;BitPlane Registers
BplCon0 = $100
BplCon1 = $102
BplCon2 = $104
BplMod1 = $108
BplMod2 = $10a
BplPt0h = $0e0
BplPt0l = $0e2
BplPt1h = $0e4
BplPt1l = $0e6
BplPt2h = $0e8
BplPt2l = $0ea
BplPt3h = $0ec
BplPt3l = $0ee
BplPt4h = $0f0
BplPt4l = $0f2
BplPt5h = $0f4
BplPt5l = $0f6
;Colour Registers
Color00 = $180
Color01 = $182
Color02 = $184
Color03 = $186
Color04 = $188
Color05 = $18a
Color06 = $18c
Color07 = $18e
Color08 = $190
Color09 = $192
Color10 = $194
Color11 = $196
Color12 = $198
Color13 = $19a
Color14 = $19c
Color15 = $19e
Color16 = $1a0
Color17 = $1a2
Color18 = $1a4
Color19 = $1a6
Color20 = $1a8
Color21 = $1aa
Color22 = $1ac
Color23 = $1ae
Color24 = $1b0
Color25 = $1b2
Color26 = $1b4
Color27 = $1b6
Color28 = $1b8
Color29 = $1ba
Color30 = $1bc
Color31 = $1be
EcsNop = $1fe